﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using Aulac.Srv.Db.Data.Ems.Items.RptLists;

namespace Aulac.Srv.Db.Data.Ems.Items
{
    public class RptListBrid: Aulac.Srv.Db.Bridge.DbAulacBridgeSrv
    {
        private RptListItem mRptListItem = null;
        private BuyCapAss mBuyCapAss = null;
        private MdnGrpItems mMdnGrpItems = null;
        private MdnItems mMdnItems = null;
        
        public RptListBrid(XmlDataDocument xmlDoc)
            : base(xmlDoc)
        {
            mRptListItem = new RptListItem(this.DbAulacConnect);
            mBuyCapAss = new BuyCapAss(this.DbAulacConnect);
            mMdnGrpItems = new MdnGrpItems(this.DbAulacConnect);
            mMdnItems = new MdnItems(this.DbAulacConnect);
        }
        
        public override System.Xml.XmlDataDocument XmlProcessReqDB(string strVerb, System.Xml.XmlDataDocument xmlDoc)
        {
            try
            {
                if (strVerb.LastIndexOf("ItemGrp") > 0)
                    return this.CalcMethod(typeof(MdnGrpItems), mMdnGrpItems, strVerb, xmlDoc);
                else if (strVerb.LastIndexOf("Item") > 0)
                    return this.CalcMethod(typeof(MdnItems), mMdnItems, strVerb, xmlDoc);
                //return this.CalcMethod(typeof(RptListItem), mRptListItem, strVerb, xmlDoc);
                return this.CalcMethod(typeof(BuyCapAss), mBuyCapAss, strVerb, xmlDoc);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
